/* 
 *  <copyright file="OwningPlayerInfo.cs" company="Wesley Jowitt">
 *  
 *  SobrietyEngine: Copyright (c) 2011 Wesley Jowitt
 *  
 *  This software is distributed under a software license.
 *   * As of the creation time of this file, the license in use is the Microsoft Permissive License (Ms-PL) 
 *    * The license can be viewed at:
 *     * License.Txt in the root folder of this project
 *      * http://sobrietyengine.codeplex.com/license
 *       * http://www.microsoft.com/opensource/licenses.mspx
 *       
 *  </copyright>
 *   */

using System;
using System.Collections.Generic;
using System.Text;

using SobrietyEngine.Common;
using SobrietyEngine.Guids;

namespace SobrietyEngine.Components.Player
{
    public class OwningPlayerInfo:BaseComponent, IComponent
    {
        CGuid playerGuid;
        public CGuid PlayerGuid
        {
            get { return playerGuid; }
            set { playerGuid = value; }
        }

        PlayerData.IPlayerGameData playerInfo;
        public PlayerData.IPlayerGameData PlayerInfo
        {
            get { return playerInfo; }
            set { playerInfo = value; }
        }

        public OwningPlayerInfo()
            : base()
        {           
        }

        override public void Set(Parameters parms)
        {
            playerGuid = (CGuid)parms["OwningPlayer"];
        }

        public override Boolean InitComponent()
        {
            base.InitComponent();
            playerInfo = (PlayerData.IPlayerGameData)playerGuid.Resolve();
            return true;
        }
    }
}